import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by Edison.hu on 18/9/26.
 */
public class test {
    public static void main(String[] args){

        String [] accountIdList = "1,2,3".split(",");
        ;
        System.out.println(JSONArray.parseArray(Arrays.asList(accountIdList).toString()));

        String url = "http://112.126.80.49:4000/query/order_info";
        HttpClient httpClient =  HttpClientBuilder.create().build();
        try{
            HttpPost post  = new HttpPost(url);
            post.setHeader("Content-type", "application/json; charset=utf-8");
            List<String> body = new ArrayList<>();
            body.add("\"3f6d1e87db8769422275acf7b5ba74e7\"");
            StringEntity entity = new StringEntity(body.toString(), Charset.forName("UTF-8"));
            entity.setContentEncoding("UTF-8");
            post.setEntity(entity);
            HttpResponse response = httpClient.execute(post);
            String j =EntityUtils.toString(response.getEntity());
                    //.replace("\\n","").replace("\\\\","");
            System.out.println(j);
            JSONObject data = JSONObject.parseObject(j);
            System.out.println(data.getString("msg"));
            JSONArray data2 = JSONArray.parseArray(data.getString("msg"));
            System.out.println(data2.getString(0));
            JSONObject data3 = JSONObject.parseObject(data2.getString(0));
            System.out.println(data3.getString("data"));

        }catch (Exception e){

        }
    }
}
